<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'tab.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<SCRIPT src="js/color.js" type="text/javascript"></SCRIPT>
			<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	font-size: 12px;
	font-weight: bold;
}

.STYLE4 {
	color: #03515d;
	font-size: 12px;
}
-->
.boxBorder {
	border: 1px solid green;
}


#addlink,#addDoclink,#userAddlink,#updateDocLink {
	position: absolute;
	width: 400px;
	left: 50%;
	top: 50%;
	margin-left: -200px;
	height: auto;
	z-index: 100;
	background-color: #fff;
	border: 1px #8FA4F5 solid;
	padding: 1px;
}

#addlink h2,#addDoclink h2,#userAddlink h2,#updateDocLink h2 {
	height: 25px;
	font-size: 14px;
	background-color:#7bc4d3;
	position: relative;
	padding-left: 10px;
	line-height: 25px;
	color: white;
}

#addlink h2 a,#addDoclink h2 a,#userAddlink h2 a,#updateDocLink h2 a {
	position: absolute;
	right: 5px;
	font-size: 12px;
	color: white;
}

#addlink .form,#addDoclink .form ,#userAddlink .form,#updateDocLink .form {
	padding-left: 10px;
}
#BgDiv,#addDocBgDiv,#addUserBgDiv,#updateDocBgDiv {
	background-color: #e3e3e3;
	position: absolute;
	z-index: 99;
	left: 0;
	top: 0;
	display: none;
	width: 100%;
	height: 1000px;
	opacity: 0.5;
	filter: alpha(opacity = 50);
	-moz-opacity: 0.5;
}
  
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
	function editUserFunction(fid,fname,furl){
			addlink.style.display="block";
			addlink.style.top="130px";
			addlink.style.left="350px";
			BgDiv.style.display="block";
			$("#edit").css("display","block");
			$("#ufid").val(fid);
			$("#ufname").val(fname);
			$("#ufurl").val(furl);
	}
	
	function editDocFunction(fid,fname,furl){
			updateDocLink.style.display="block";
			updateDocLink.style.top="130px";
			updateDocLink.style.left="350px";
			updateDocBgDiv.style.display="block";
			$("#updateDocEdit").css("display","block");
		$("#dfid").val(fid);
		$("#dfname").val(fname);
		$("#dfurl").val(furl);
	}
	
	function addDocFunction(){
			addDoclink.style.display="block";
			addDoclink.style.top="130px";
			addDoclink.style.left="350px";
			addDocBgDiv.style.display="block";
			$("#addDocedit").css("display","block");
	}
	function addUserFunction(){
			userAddlink.style.display="block";
			userAddlink.style.top="130px";
			userAddlink.style.left="350px";
			addUserBgDiv.style.display="block";
			$("#addUserEdit").css("display","block");
	}
	function closeMe(){
			BgDiv.style.display="none";
	 		$("#edit").css("display","none");
		}
		function closedocMe(){
			addDocBgDiv.style.display="none";
	 		$("#addDocedit").css("display","none");
		}
		
		function closeUserMe(){
			addUserBgDiv.style.display="none";
	 		$("#addUserEdit").css("display","none");
		}
		
		function closeUpdateDoc(){
			updateDocBgDiv.style.display="none";
	 		$("#updateDocEdit").css("display","none");
		}
		
		function showDocFunction(){
			$("#showDocFunction").css("display","block");
			$("#showUserFunction").css("display","none");
		}
		
		function showUserFunction(){
			$("#showUserFunction").css("display","block");
			$("#showDocFunction").css("display","none");
		}
		
		function docCheck(){
                        var fname = document.docForm.fname.value;   // 科别
                        var furl = document.docForm.furl.value;   // 科室
                        if(fname==""){
	                        alert("功能名称不能为空!");
	                        return false;
                        }
                        
                         if(furl==""){
	                        alert("功能路径不能为空！");
	                        return false;
                        }
                        
                         return true;
                     }
                     
                     
                     function userCheck(){
                        var fname = document.userForm.fname.value;   // 科别
                        var furl = document.userForm.furl.value;   // 科室
                        if(fname==""){
	                        alert("功能名称不能为空!");
	                        return false;
                        }
                        
                         if(furl==""){
	                        alert("功能路径不能为空！");
	                        return false;
                        }
                        
                         return true;
                     }
</script>
 
	</head>
	<body>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="30" background="backstage/tab/images//tab_05.gif">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="12" height="30">
								<img src="backstage/tab/images//tab_03.gif" width="12"
									height="30" />
							</td>
							<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="46%" valign="middle">
											<table width="100%" border="0" cellspacing="0"
												cellpadding="0">
												<tr>
													<td width="5%">
														<div align="center">
															<img src="backstage/tab/images//tb.gif" width="16"
																height="16" />
														</div>
													</td>
													<td width="95%" class="STYLE1">
														<span class="STYLE3">你当前的位置</span>：[业务中心]-[功能增减]
													</td>
												</tr>
											</table>
										</td>
										<td width="54%">
											<table border="0" align="right" cellpadding="0"
												cellspacing="0">
												<tr>
													<td width="60">
														<table width="87%" border="0" cellpadding="0"
															cellspacing="0">
															<tr>
															</tr>
														</table>
													</td>
													<td width="60">
														<table width="90%" border="0" cellpadding="0"
															cellspacing="0">
															<tr>
															</tr>
														</table>
													</td>
													<td width="60">
														<table width="90%" border="0" cellpadding="0"
															cellspacing="0">
															<tr>
															</tr>
														</table>
													</td>
													<td width="52">
														<table width="88%" border="0" cellpadding="0"
															cellspacing="0">
															<tr>
															</tr>
														</table>
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
							<td width="16">
								<img src="backstage/tab/images//tab_07.gif" width="16"
									height="30" />
							</td>
						</tr>
						<tr>
							<td width="12" height="30">
								<br>
							</td>
							<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="46%" valign="middle">
											<table width="100%" border="0" cellspacing="0"
												cellpadding="0">
												<tr>
													<td width="5%">
														<div align="center">
															<img src="backstage/tab/images//tb.gif" width="16"
																height="16" />
														</div>
													</td>
													<td width="95%" class="STYLE1">
														<span class="STYLE3">功能：</span>
														<span style="cursor:pointer;">
														<a style="color: blue; border: 1px"
															onclick="showDocFunction()"> 医生功能<a onclick="addDocFunction()">【添加】</a>
														</a> 
														</span>-----------
														<span style="cursor:pointer;">
														<a style="color: blue; border: 1px"
															onclick="showUserFunction()">
															用户功能 </a>
														<a onclick="addUserFunction()">【添加】</a>
														</span>
													</td>
												</tr>
											</table>
										</td>

									</tr>
								</table>
							</td>
							<td width="16">
								<br>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellpadding="0" cellspacing="1"
						bgcolor="b5d6e6" onmouseover="changeto()"
									onmouseout="changeback()">
						<tr>
							<td>
							<c:if test="${message != null}">
								<table width="100%">
									<tr style="background-color: #87CEFF">
										<td align="center" valign="center" height="30">
											<div>${message}</div>
										</td>
									</tr>
								</table>
							</c:if>
								<div id="showUserFunction">
								<table width="100%" border="0" cellpadding="0" cellspacing="1"
									bgcolor="b5d6e6">
									<tr>
									<td width="25%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">功能序列</span>
											</div>
										</td>
										<td width="25%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">功能名称</span>
											</div>
										</td>
										<td width="30%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">功能路径</span>
											</div>
										</td>
										<td width="15%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF"
											class="STYLE1">
											<div align="center">
												基本操作
											</div>
										</td>
									</tr>
									<c:forEach items="${userFunction}" var="function" varStatus="i">
									<tr>
										<td width='12%' height='20' bgcolor='#FFFFFF'>
											<div align='center'>
												<span class='STYLE1'>${i.index}</span>
											</div>
										</td>
										<td width='14%' height='20' bgcolor='#FFFFFF'>
											<div align='center'>
												<span class='STYLE1'>${function.fname}</span>
											</div>
										</td>
										<td width='18%' bgcolor='#FFFFFF'>
											<div align='center'>
												<span class='STYLE1'>${function.furl}</span>
											</div>
										</td>										
										<td height='20' width='15%' bgcolor='#FFFFFF'>										
											<div align='center'>
												<span class='STYLE4'>
												<img src="backstage/tab/images//edt.gif" width="16" height="16" />
												<a onclick="editUserFunction('${function.fid}','${function.fname}','${function.furl}')"><span style="cursor:pointer;">编辑</span></a>&nbsp;
												<img src="backstage/tab/images//del.gif" width="16" height="16" />
												<a href="function.do?method=delUserFunction&fid=${function.fid}" onclick="return confirm('确定删除该功能？');"><span style="cursor:pointer;">删除</span></a>
												</span>
											</div>
										</td>
									</tr>
									</c:forEach>
								</table>
								</div>
								
								<div id="showDocFunction" style="display:none">
								<table width="100%" border="0" cellpadding="0" cellspacing="1"
									bgcolor="b5d6e6">
									<tr>
									<td width="25%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">功能序列</span>
											</div>
										</td>
										<td width="25%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">功能名称</span>
											</div>
										</td>
										<td width="30%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">功能路径</span>
											</div>
										</td>
										<td width="15%" height="22"
											background="backstage/tab/images//bg.gif" bgcolor="#FFFFFF"
											class="STYLE1">
											<div align="center">
												基本操作
											</div>
										</td>
									</tr>
									<c:forEach items="${doctorFunction}" var="function" varStatus="i">
									<tr>
										<td width='12%' height='20' bgcolor='#FFFFFF'>
											<div align='center'>
												<span class='STYLE1'>${i.index}</span>
											</div>
										</td>
										<td width='14%' height='20' bgcolor='#FFFFFF'>
											<div align='center'>
												<span class='STYLE1'>${function.fname}</span>
											</div>
										</td>
										<td width='18%' bgcolor='#FFFFFF'>
											<div align='center'>
												<span class='STYLE1'>${function.furl}</span>
											</div>
										</td>										
										<td height='20' width='15%' bgcolor='#FFFFFF'>										
											<div align='center'>
												<span class='STYLE4'>
												<a onclick="editDocFunction('${function.fid}','${function.fname}','${function.furl}')">编辑</a>&nbsp;
													&nbsp;<a href="function.do?method=delDoctorFunction&fid=${function.fid}" onclick="return confirm('确定删除该功能？');">删除</a>
												</span>
											</div>
										</td>
									</tr>
									</c:forEach>
								</table>
								</div>
						</tr>
						<tr>
							<td>
								<table id="foodname" width="100%" border="0" cellpadding="0"
									cellspacing="1" bgcolor="b5d6e6">
								</table>
							</td>
						</tr>

					</table>


				</td>
			</tr>
			<tr>
				<td height="35"
					background="backstage/tab/backstage/tab/images///tab_19.gif">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="12" height="35">
								<br>
							</td>
							<td>
								 
							</td>
							<td width="16">
								<br>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		
		<div id="BgDiv"></div>
				<div  id="edit" style="display: none">
    <div id="addlink" style="width:423px;height:150px;margin:0px auto 0px;padding:1px;border:1px solid #a5b6c8;background-color:#eef3f7;">
    <h2 id="bianji">
						修改用户功能
				<a href="javascript: closeMe( )">关闭</a>
			</h2>
		<div class="form">
				<FORM METHOD=post ACTION="function.do?method=updateUserFunction">
					<input type="hidden" name="fid" id="ufid"/>
				功能名称：<input type="text" name="fname" id="ufname"/><br/>
				功能路径：<input type="text" name="furl" id="ufurl"/><br/>	
				<input type="submit" value="修改"/>
			</FORM>
    </div>
    </div>
    </div>
		
		<div id="updateDocBgDiv"></div>
				<div  id="updateDocEdit" style="display: none">
    <div id="updateDocLink" style="width:423px;height:150px;margin:0px auto 0px;padding:1px;border:1px solid #a5b6c8;background-color:#eef3f7;">
    <h2 id="bianji">
						修改医生功能
				<a href="javascript: closeUpdateDoc( )">关闭</a>
			</h2>
		<div class="form">
				<FORM METHOD=post ACTION="function.do?method=updateDoctorFunction">
					<input type="hidden" name="fid" id="dfid"/>
				功能名称：<input type="text" name="fname" id="dfname"/><br/>
				功能路径：<input type="text" name="furl" id="dfurl"/><br/>	
				<input type="submit" value="修改"/>
			</FORM>
    </div>
    </div>
    </div>
    
    
    <div id="addDocBgDiv"></div>
				<div  id="addDocedit" style="display: none">
    <div id="addDoclink" style="width:423px;height:150px;margin:0px auto 0px;padding:1px;border:1px solid #a5b6c8;background-color:#eef3f7;">
    <h2 id="bianji">
						添加医生功能
				<a href="javascript: closedocMe( )">关闭</a>
			</h2>
		<div class="form">
				<FORM METHOD=post ACTION="function.do?method=addDoctorFunction" name="docForm">
					功能名称：<input type="text" name="fname"/><br/>
				功能路径：<input type="text" name="furl"/><br/>	
				<center><input type="submit" value="添加" onclick="return docCheck()"/></center>
			</FORM>
    </div>
    </div>
    </div>
    
    
     <div id="addUserBgDiv"></div>
				<div  id="addUserEdit" style="display: none">
    <div id="userAddlink" style="width:423px;height:150px;margin:0px auto 0px;padding:1px;border:1px solid #a5b6c8;background-color:#eef3f7;">
    <h2 id="bianji">
						添加用户功能
				<a href="javascript: closeUserMe( )">关闭</a>
			</h2>
		<div class="form">
				<FORM METHOD=post ACTION="function.do?method=addUserFunction" name="userForm">
					功能名称：<input type="text" name="fname"/><br/>
				功能路径：<input type="text" name="furl"/><br/>	
				<center><input type="submit" value="添加" onclick="return userCheck()"/></center>
			</FORM>
	    </div>
	    </div>
	    </div>
	</body>
</html>
